for n in range (1000,10000):   
    a = n//1000
    b = (n//100)%10
    c = (n//10)%10
    d = n%10
    if a ==b and c==d:
        print(n)
        
